﻿using System.Data;
using System.Web;
using NHibernate;

namespace MarketPlace.Data
{
    public class GlobalSetup
    {
        private static NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration().Configure(HttpContext.Current.Server.MapPath("~/hibernate.cfg.xml"));

        private static ISessionFactory factory = cfg.BuildSessionFactory();

        public static ISession CreateSession()
        {
            return factory.OpenSession();
        }

        public static ISession CreateSession(IDbConnection con)
        {
            return factory.OpenSession(con);
        }
    }
}
